package com.hws.leetcode.Day_01_08;

import java.util.Arrays;
import java.util.Comparator;

/**
 * ClassName:ArraySortTest
 * Package:com.hws.leetcode.Day_01_08
 * Description:
 *
 * @ date:2022/1/8 15:59
 * @ author:hws
 */
public class ArraySortTest {
    public static void main(String[] args) {
        int[][] nums = new int[][]{{1, 2}, {4, 6}, {4, 8}, {3, 1}};
        Arrays.sort(nums, new Comparator<int[]>() {
            @Override
            public int compare(int[] a, int[] b) {
                return a[0] == b[0] ? b[1] - a[1] : a[0] - b[0];
            }
        });
        System.out.println(Arrays.deepToString(nums));
    }
}
